/* tessellation.h is part of VIP program
 * Written by J. Salvador Arias, 2010
 *      CONICET, INSUE, Instituto Miguel Lillo,
 *      Miguel Lillo 205, S.M. de Tucuman (4000)
 *      Tucuman, Argentina
 *      e-mail: jsalarias@csnat.unt.edu.ar
 *
 * VIP is a free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation and
 * Creative Commons.
 *
 * This file and the VIP program is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * To view a copy of this license, visit
 * http://creativecommons.org/licenses/GPL/2.0/
 * or send a letter to
 * Creative Commons, 171 Second Street, Suite 300,
 * San Francisco, California, 94105, USA.
 */

#ifndef TESSELLATION_HEADER_INCLUDED
#define TESSELLATION_HEADER_INCLUDED

/* ------ Data types for the Voronoi "line" used to mark disjunctions ------ */

#include "biogeo.h"
#include "grid.h"
#include "bitfield.h"

#define STATE_NOCELL 0
#define STATE_SETA   1
#define STATE_SETB   2

/* Triangle use the trigonometric notation, with segment a as the
   segment in front point A (i.e. the segment between B-C) */
typedef struct tagDELAUNAYTRIANGLE DELAUNAYTRIANGLE;
struct tagDELAUNAYTRIANGLE {
 GList* list;
 SINTEGER col [3];
 SINTEGER row [3];
 SFLAG state [3];
 SREAL cX;
 SREAL cY;
 SREAL r;
 DELAUNAYTRIANGLE* neighbor [3];
 SCOUNTER id;
};

GList* MakeVoronoi (BITFIELD* iniA, BITFIELD* iniB);
void DestroyTriangleList (GList* triangleList);

#endif
